import unittest
from unittest import runner

import app
from lib.HTMLTestRunner_PY3 import HTMLTestRunner
from script.test02_login import Testlogin

# 1.创建测试套件
from script.test03_emp import TestEmp

suite = unittest.TestSuite()

# 2.在测试套件中添加测试类
suite.addTest(unittest.makeSuite(Testlogin))
suite.addTest(unittest.makeSuite(TestEmp))

# 3.指定测试报告存放的位置
report_path=app.BASE_PATH+"/report/report.html"
#将执行结果写入到测试报告中
with open(report_path,mode="wb")as f:
    # 4.实例化HTMLTestRunner对象
    runner=HTMLTestRunner(f)
    # 5.执行测试套件
    runner.run(suite)




# # 3.实例化TextTestRunner
# runner = unittest.TextTestRunner()
#
# # 4.执行测试套件
# runner.run(suite)